Don't sort a list of values as if it was a list of entries. This fixes
authorMatthias Clasen <mclasen@redhat.com>
Fri, 31 Dec 2004 06:40:05 +0000 (06:40 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 31 Dec 2004 06:40:05 +0000 (06:40 +0000)
2004-12-31  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkkeyhash.c (_gtk_key_hash_lookup_keyval)
(_gtk_key_hash_lookup): Don't sort a list of values as if
it was a list of entries. This fixes crashes during mnemonic
activation in the presence of multiple keymaps. (#162488,
Christian Persch)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkkeyhash.c

index 39f7906561d20a8d17e72fcb8e0c322de60d38f4..306bbbbe1e69f26661c47299c36e6099bfaec6b3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-12-31  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkkeyhash.c (_gtk_key_hash_lookup_keyval) 
+       (_gtk_key_hash_lookup): Don't sort a list of values as if
+       it was a list of entries. This fixes crashes during mnemonic
+       activation in the presence of multiple keymaps. (#162488, 
+       Christian Persch)
+
 2004-12-30  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkcombobox.c (gtk_combo_box_button_state_changed): Fix
index 39f7906561d20a8d17e72fcb8e0c322de60d38f4..306bbbbe1e69f26661c47299c36e6099bfaec6b3 100644 (file)
@@ -1,3 +1,11 @@
+2004-12-31  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkkeyhash.c (_gtk_key_hash_lookup_keyval) 
+       (_gtk_key_hash_lookup): Don't sort a list of values as if
+       it was a list of entries. This fixes crashes during mnemonic
+       activation in the presence of multiple keymaps. (#162488, 
+       Christian Persch)
+
 2004-12-30  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkcombobox.c (gtk_combo_box_button_state_changed): Fix
index 39f7906561d20a8d17e72fcb8e0c322de60d38f4..306bbbbe1e69f26661c47299c36e6099bfaec6b3 100644 (file)
@@ -1,3 +1,11 @@
+2004-12-31  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkkeyhash.c (_gtk_key_hash_lookup_keyval) 
+       (_gtk_key_hash_lookup): Don't sort a list of values as if
+       it was a list of entries. This fixes crashes during mnemonic
+       activation in the presence of multiple keymaps. (#162488, 
+       Christian Persch)
+
 2004-12-30  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkcombobox.c (gtk_combo_box_button_state_changed): Fix
index 39f7906561d20a8d17e72fcb8e0c322de60d38f4..306bbbbe1e69f26661c47299c36e6099bfaec6b3 100644 (file)
@@ -1,3 +1,11 @@
+2004-12-31  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkkeyhash.c (_gtk_key_hash_lookup_keyval) 
+       (_gtk_key_hash_lookup): Don't sort a list of values as if
+       it was a list of entries. This fixes crashes during mnemonic
+       activation in the presence of multiple keymaps. (#162488, 
+       Christian Persch)
+
 2004-12-30  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkcombobox.c (gtk_combo_box_button_state_changed): Fix
index 3ff8deb687bb2ec909da9d9741575925d4de0607..9d4e41b71c9815af8dad5213d81787724c39f155 100644 (file)
@@ -332,6 +332,7 @@ _gtk_key_hash_lookup (GtkKeyHash      *key_hash,
   GHashTable *keycode_hash = key_hash_get_keycode_hash (key_hash);
   GSList *keys = g_hash_table_lookup (keycode_hash, GUINT_TO_POINTER ((guint)hardware_keycode));
   GSList *results = NULL;
+  GSList *l;
   gboolean have_exact = FALSE;
   guint keyval;
   gint effective_group;
@@ -375,7 +376,7 @@ _gtk_key_hash_lookup (GtkKeyHash      *key_hash,
                    }
 
                  have_exact = TRUE;
-                 results = g_slist_prepend (results, entry->value);
+                 results = g_slist_prepend (results, entry);
                }
 
              if (!have_exact)
@@ -388,7 +389,7 @@ _gtk_key_hash_lookup (GtkKeyHash      *key_hash,
                          GTK_NOTE (KEYBINDINGS,
                                    g_message ("  found group = %d, level = %d",
                                               entry->keys[i].group, entry->keys[i].level));
-                         results = g_slist_prepend (results, entry->value);
+                         results = g_slist_prepend (results, entry);
                          break;
                        }
                    }
@@ -399,7 +400,11 @@ _gtk_key_hash_lookup (GtkKeyHash      *key_hash,
        }
     }
 
-  return sort_lookup_results (results);
+  results = sort_lookup_results (results);
+  for (l = results; l; l = l->next)
+    l->data = ((GtkKeyHashEntry *)l->data)->value;
+
+  return results;
 }
 
 /**
@@ -423,6 +428,7 @@ _gtk_key_hash_lookup_keyval (GtkKeyHash     *key_hash,
   GdkKeymapKey *keys;
   gint n_keys;
   GSList *results = NULL;
+  GSList *l;
 
   if (!keyval)                 /* Key without symbol */
     return NULL;
@@ -442,7 +448,7 @@ _gtk_key_hash_lookup_keyval (GtkKeyHash     *key_hash,
          GtkKeyHashEntry *entry = entries->data;
 
          if (entry->keyval == keyval && entry->modifiers == modifiers)
-           results = g_slist_prepend (results, entry->value);
+           results = g_slist_prepend (results, entry);
 
          entries = entries->next;
        }
@@ -450,5 +456,9 @@ _gtk_key_hash_lookup_keyval (GtkKeyHash     *key_hash,
 
   g_free (keys);
          
-  return sort_lookup_results (results);
+  results = sort_lookup_results (results);
+  for (l = results; l; l = l->next)
+    l->data = ((GtkKeyHashEntry *)l->data)->value;
+
+  return results;
 }